package com.qianwang.shopmsg.repository.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.qianwang.shopmsg.entity.TeacherInfo;
import com.qianwang.shopmsg.repository.BaseDao;
import com.qianwang.shopmsg.repository.TeacherMsgDao;

@Repository("teacherMsgDao")
@SuppressWarnings("unchecked")
public class TeacherMsgDaoImpl extends BaseDao implements TeacherMsgDao {

	@Override
	public TeacherInfo loadTeacherInfo(long id) {
		return (TeacherInfo)getSqlMapClientTemplate().queryForObject("TeacherInfo.loadTeacherInfo", id);
	}

	@Override
	public void addTeacherInfo(TeacherInfo teacherInfo) {
		getSqlMapClientTemplate().insert("TeacherInfo.addTeacherInfo", teacherInfo);
	}

	@Override
	public void updateTeacherInfo(TeacherInfo teacherInfo) {
		getSqlMapClientTemplate().update("TeacherInfo.updateTeacherInfo", teacherInfo);
	}

	@Override
	public List<TeacherInfo> listTeacherInfos(Map<String, Object> param) {
		return (List<TeacherInfo>)getSqlMapClientTemplate().queryForList("TeacherInfo.listTeacherInfos", param);
	}

	@Override
	public int countTeacherInfo(Map<String, Object> param) {
		Integer count = (Integer)getSqlMapClientTemplate().queryForObject("TeacherInfo.countTeacherInfos",param);
		return count == null?0:count;
	}

	@Override
	public void deleteTeacherInfoById(long id) {
		getSqlMapClientTemplate().delete("TeacherInfo.deleteTeacherInfoById", id);
	}
	
}
